/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import Utilitarios.MDIDesktopPane;
import dao.FuncionarioDAO;
import dao.PessoaDAO;
import java.awt.AWTKeyStroke;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import static java.awt.Frame.MAXIMIZED_BOTH;
import java.awt.KeyboardFocusManager;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.beans.PropertyVetoException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.tree.DefaultTreeModel;
import model.Funcionario;
import model.Pessoa;
import model.Setor;

/**
 *
 * @author eversonpaulo
 */
public class fPrincipal extends javax.swing.JFrame {

    private static fPrincipal p;

    private MDIDesktopPane panelPrincipal = new MDIDesktopPane();
    private JScrollPane scrollPane = new JScrollPane();
    //public static String usuario;
//  - - - >>> Quando Quiser Isolar a Tela de Apresentação << - - //
    public static String usuario = LoginView.getUsuario();
//  - - - >>> Quando Quiser Isolar a Tela de Apresentação << - - //    
    public static String nomeUsuario;
    public static String nomeSetor;
    public static String mesANO;
//  - - - >>> Para ajudar na hora de saber o setor do usuário sem precisar ir sempre no bando << - - //
    public static Setor setorUsuario;

    public static fPrincipal getInstancia() {
        if (p == null) {
            p = new fPrincipal();
        }
        return p;
    }

    public static JDesktopPane getPanel() {
        return getInstancia().panelPrincipal;

    }

    public fPrincipal() {

        JOptionPane.setRootFrame(this);

//  - - - >>> Quando Quiser Isolar a Tela de Apresentação << - - //
        LoginView login = new LoginView(this, true);
        login.setVisible(true);
        login.toFront();
        usuario = LoginView.getUsuario();

        TesteInternal ti = new TesteInternal();
        this.addTelaDesk(ti);
//  - - - >>> Quando Quiser Isolar a Tela de Apresentação << - - //

        //Colocando enter para pular de campo
        //HashSet conj = new HashSet(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
        HashSet backup = new HashSet(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
        HashSet conj = (HashSet) backup.clone();
        conj.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
        this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, conj);

        initComponents();

        setIcone();

        pagarParametros();

        lbOcara.setText(nomeUsuario.trim());
        // lbQmes.setText(mesANO.substring(0, 2) + "/" + mesANO.substring(2, 6));
        lboSetor.setText(nomeSetor.trim());
        lbUsuario.setFont(new Font("Tahoma", Font.PLAIN, 10));
        jlsetor.setFont(new Font("Tahoma", Font.PLAIN, 10));
        //lbMesAno.setFont(new Font("Tahoma", Font.PLAIN, 10));
        lbOcara.setFont(new Font("Tahoma", Font.BOLD, 11));
        lboSetor.setFont(new Font("Tahoma", Font.BOLD, 11));
        //lbQmes.setFont(new Font("Tahoma", Font.BOLD, 11));
        lbUsuario.setText("Usuário Logado: ");
//        lbMesAno.setText("Mês de Referência: " + mesANO.substring(0, 2) + "/" + mesANO.substring(2, 6));

        //Adiciona os Panels ao DesktopPane
        scrollPane.getViewport().add(panelPrincipal);
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(barraLateral, BorderLayout.WEST);
        //getContentPane().add(barraDireita,BorderLayout.SOUTH);
        //getContentPane().add(barraInferior, BorderLayout.SOUTH);
        getContentPane().add(scrollPane, BorderLayout.CENTER);
        getContentPane().add(barraInformacao, BorderLayout.NORTH);
        this.setExtendedState(MAXIMIZED_BOTH);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jLabel7 = new javax.swing.JLabel();
        barraInformacao = new javax.swing.JPanel();
        lbOcara = new javax.swing.JLabel();
        lbUsuario = new javax.swing.JLabel();
        jlsetor = new javax.swing.JLabel();
        lboSetor = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        barraLateral = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        lbProcesso = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        lbPesquisaProcesso = new javax.swing.JLabel();
        lbArquivaProcesso = new javax.swing.JLabel();
        lbSetor = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        lbAssunto = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        lbTramitar = new javax.swing.JLabel();
        lbReceberProcesso = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        menuPrincipal = new javax.swing.JMenuBar();
        menuCadastro = new javax.swing.JMenu();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        MenuOrigem = new javax.swing.JMenuItem();
        menuAssunto = new javax.swing.JMenuItem();
        menuTipoProduto = new javax.swing.JMenuItem();
        menuSetor = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        MenuFuncionario = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        menuUsuario = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        menuSair = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMProcesso = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JPopupMenu.Separator();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator8 = new javax.swing.JPopupMenu.Separator();
        jMenuItem2 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuAjuda = new javax.swing.JMenu();
        jMenuUsuario = new javax.swing.JMenuItem();
        menuSobre = new javax.swing.JMenuItem();

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        jMenuItem8.setText("jMenuItem8");

        jLabel7.setText("jLabel7");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        addContainerListener(new java.awt.event.ContainerAdapter() {
            public void componentAdded(java.awt.event.ContainerEvent evt) {
                formComponentAdded(evt);
            }
        });

        barraInformacao.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        barraInformacao.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        lbOcara.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        lbOcara.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lbOcara.setText("oCara");

        lbUsuario.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        lbUsuario.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lbUsuario.setText("Usuário Logado: ");

        jlsetor.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jlsetor.setText("Setor:");

        lboSetor.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        lboSetor.setText("oSetor");

        jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1400262078_user1.png"))); // NOI18N
        jLabel9.setToolTipText("Trocar Usuário");
        jLabel9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel9MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabel9MouseEntered(evt);
            }
        });

        javax.swing.GroupLayout barraInformacaoLayout = new javax.swing.GroupLayout(barraInformacao);
        barraInformacao.setLayout(barraInformacaoLayout);
        barraInformacaoLayout.setHorizontalGroup(
            barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, barraInformacaoLayout.createSequentialGroup()
                .addContainerGap(706, Short.MAX_VALUE)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addGroup(barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(barraInformacaoLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(lbUsuario)
                        .addGap(3, 3, 3)
                        .addComponent(lbOcara)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, barraInformacaoLayout.createSequentialGroup()
                        .addGap(57, 57, 57)
                        .addComponent(jlsetor)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lboSetor)
                        .addGap(12, 12, 12))))
        );
        barraInformacaoLayout.setVerticalGroup(
            barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(barraInformacaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addGroup(barraInformacaoLayout.createSequentialGroup()
                        .addGroup(barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(lbUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(lbOcara, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(barraInformacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jlsetor)
                            .addComponent(lboSetor))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        barraLateral.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1400260786_Briefcase.png"))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1400260120_search_b.png"))); // NOI18N

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1400259204_open-file.png"))); // NOI18N

        lbProcesso.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lbProcesso.setText("Processo");
        lbProcesso.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbProcessoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbProcessoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbProcessoMouseExited(evt);
            }
        });

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1400262801_Department.png"))); // NOI18N

        lbPesquisaProcesso.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lbPesquisaProcesso.setText("Pesquisar Processo");
        lbPesquisaProcesso.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbPesquisaProcessoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbPesquisaProcessoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbPesquisaProcessoMouseExited(evt);
            }
        });

        lbArquivaProcesso.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lbArquivaProcesso.setText("Arquivar Processo");
        lbArquivaProcesso.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbArquivaProcessoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbArquivaProcessoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbArquivaProcessoMouseExited(evt);
            }
        });

        lbSetor.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lbSetor.setText("Setor");
        lbSetor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbSetorMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbSetorMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbSetorMouseExited(evt);
            }
        });

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/tramitar.png"))); // NOI18N

        lbAssunto.setText("Assunto");
        lbAssunto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbAssuntoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbAssuntoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbAssuntoMouseExited(evt);
            }
        });

        jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/chat_talk_voice_bubble_phone-32.png"))); // NOI18N

        lbTramitar.setText("Tramitar Processo");
        lbTramitar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbTramitarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbTramitarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbTramitarMouseExited(evt);
            }
        });

        lbReceberProcesso.setText("Receber Processo");
        lbReceberProcesso.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbReceberProcessoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lbReceberProcessoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbReceberProcessoMouseExited(evt);
            }
        });

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/1402347244_mail-send-receive.png"))); // NOI18N

        javax.swing.GroupLayout barraLateralLayout = new javax.swing.GroupLayout(barraLateral);
        barraLateral.setLayout(barraLateralLayout);
        barraLateralLayout.setHorizontalGroup(
            barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(barraLateralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lbArquivaProcesso, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lbReceberProcesso, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(barraLateralLayout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbProcesso))
                            .addGroup(barraLateralLayout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbPesquisaProcesso, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(barraLateralLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbSetor))
                            .addGroup(barraLateralLayout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbAssunto))
                            .addGroup(barraLateralLayout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lbTramitar, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        barraLateralLayout.setVerticalGroup(
            barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(barraLateralLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addComponent(lbProcesso))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2))
                    .addComponent(lbPesquisaProcesso))
                .addGap(18, 18, 18)
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbArquivaProcesso, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel6)
                            .addComponent(lbSetor))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel13))
                    .addComponent(lbAssunto))
                .addGap(18, 18, 18)
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbTramitar)
                    .addComponent(jLabel11))
                .addGroup(barraLateralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(barraLateralLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel8))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, barraLateralLayout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(lbReceberProcesso)))
                .addContainerGap(317, Short.MAX_VALUE))
        );

        jLabel1.getAccessibleContext().setAccessibleName("Processo");
        jLabel1.getAccessibleContext().setAccessibleDescription("Processo");
        jLabel2.getAccessibleContext().setAccessibleName("Pesquisar");
        jLabel2.getAccessibleContext().setAccessibleDescription("Pesquisar");
        jLabel3.getAccessibleContext().setAccessibleName("Arquivar");
        jLabel3.getAccessibleContext().setAccessibleDescription("Arquivar");
        jLabel6.getAccessibleContext().setAccessibleName("Setor");
        jLabel6.getAccessibleContext().setAccessibleDescription("Setor");
        jLabel11.getAccessibleContext().setAccessibleName("Tramitar");
        jLabel11.getAccessibleContext().setAccessibleDescription("Tramitar");

        menuCadastro.setText("   Cadastros      ");
        menuCadastro.add(jSeparator5);

        MenuOrigem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK));
        MenuOrigem.setText("Origem");
        MenuOrigem.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                MenuOrigemMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                MenuOrigemMouseExited(evt);
            }
        });
        MenuOrigem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuOrigemActionPerformed(evt);
            }
        });
        menuCadastro.add(MenuOrigem);

        menuAssunto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK));
        menuAssunto.setText("Assunto");
        menuAssunto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuAssuntoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuAssuntoMouseExited(evt);
            }
        });
        menuAssunto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuAssuntoActionPerformed(evt);
            }
        });
        menuCadastro.add(menuAssunto);

        menuTipoProduto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        menuTipoProduto.setText("Tipo");
        menuTipoProduto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuTipoProdutoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuTipoProdutoMouseExited(evt);
            }
        });
        menuTipoProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuTipoProdutoActionPerformed(evt);
            }
        });
        menuCadastro.add(menuTipoProduto);

        menuSetor.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        menuSetor.setText("Setor");
        menuSetor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuSetorMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuSetorMouseExited(evt);
            }
        });
        menuSetor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSetorActionPerformed(evt);
            }
        });
        menuCadastro.add(menuSetor);
        menuCadastro.add(jSeparator1);
        menuCadastro.add(jSeparator4);

        MenuFuncionario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        MenuFuncionario.setText("Funcionário");
        MenuFuncionario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                MenuFuncionarioMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                MenuFuncionarioMouseExited(evt);
            }
        });
        MenuFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuFuncionarioActionPerformed(evt);
            }
        });
        menuCadastro.add(MenuFuncionario);

        jMenu3.setText("Interesado");

        menuUsuario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        menuUsuario.setText("Pessoa");
        menuUsuario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuUsuarioMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuUsuarioMouseExited(evt);
            }
        });
        menuUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuUsuarioActionPerformed(evt);
            }
        });
        jMenu3.add(menuUsuario);

        menuCadastro.add(jMenu3);
        menuCadastro.add(jSeparator3);

        menuSair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        menuSair.setText("Sair");
        menuSair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuSairMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuSairMouseExited(evt);
            }
        });
        menuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSairActionPerformed(evt);
            }
        });
        menuCadastro.add(menuSair);

        menuPrincipal.add(menuCadastro);

        jMenu4.setText("   Processo");

        jMProcesso.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMProcesso.setText("Novo");
        jMProcesso.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMProcessoMouseClicked(evt);
            }
        });
        jMProcesso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMProcessoActionPerformed(evt);
            }
        });
        jMenu4.add(jMProcesso);
        jMenu4.add(jSeparator7);

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem3.setText("Arquivar Processo");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem3);
        jMenu4.add(jSeparator6);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem1.setText("Receber Processo");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem1);
        jMenu4.add(jSeparator8);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem2.setText("Tramitar Processo");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem2);
        jMenu4.add(jSeparator2);

        menuPrincipal.add(jMenu4);

        menuAjuda.setText("   Ajuda");
        menuAjuda.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuAjudaMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuAjudaMouseExited(evt);
            }
        });

        jMenuUsuario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        jMenuUsuario.setText("Trocar Usuário");
        jMenuUsuario.setToolTipText("");
        jMenuUsuario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jMenuUsuarioMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jMenuUsuarioMouseExited(evt);
            }
        });
        jMenuUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuUsuarioActionPerformed(evt);
            }
        });
        menuAjuda.add(jMenuUsuario);

        menuSobre.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        menuSobre.setText("Sobre");
        menuSobre.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                menuSobreMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                menuSobreMouseExited(evt);
            }
        });
        menuSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSobreActionPerformed(evt);
            }
        });
        menuAjuda.add(menuSobre);

        menuPrincipal.add(menuAjuda);

        setJMenuBar(menuPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(barraInformacao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                .addComponent(barraLateral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(barraInformacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(barraLateral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSobreActionPerformed
//        frameSobre sobre = new frameSobre(this, true);
//        sobre.setLocationRelativeTo(null);
//        sobre.setVisible(true);[]
        JOptionPane.showMessageDialog(null, "\nDesenvolvido por:\nDITC - Divisão de Informática Tecnico Científico", "Sobre", JOptionPane.DEFAULT_OPTION, null);
    }//GEN-LAST:event_menuSobreActionPerformed

    private void menuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_menuSairActionPerformed

    private void menuSetorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSetorActionPerformed

        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameSetor se = new frameSetor();
        //define o tamanho da tela, baseado no tamanho do jPanel
        se.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(se);
    }//GEN-LAST:event_menuSetorActionPerformed

    private void menuAssuntoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAssuntoActionPerformed
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameAssunto as = new frameAssunto();
        //define o tamanho da tela, baseado no tamanho do jPanel
        as.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(as);
    }//GEN-LAST:event_menuAssuntoActionPerformed

    private void menuTipoProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuTipoProdutoActionPerformed
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameTipo ti = new frameTipo();
        //define o tamanho da tela, baseado no tamanho do jPanel
        ti.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(ti);
    }//GEN-LAST:event_menuTipoProdutoActionPerformed

    private void jMenuUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuUsuarioActionPerformed

        p.setVisible(false);
        LoginView l = new LoginView(LoginView.CadFiliado, true);
        l.setVisible(true);
        pagarParametros();
        p.setVisible(true);

    }//GEN-LAST:event_jMenuUsuarioActionPerformed

    private void formComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_formComponentAdded

    }//GEN-LAST:event_formComponentAdded

    private void MenuFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuFuncionarioActionPerformed
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameFuncionario dc = new frameFuncionario();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
    }//GEN-LAST:event_MenuFuncionarioActionPerformed

    private void MenuOrigemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuOrigemActionPerformed
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameOrigem dc = new frameOrigem();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_MenuOrigemActionPerformed

    private void menuUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuUsuarioActionPerformed

        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        framePessoa pe = new framePessoa();
        //define o tamanho da tela, baseado no tamanho do jPanel
        pe.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(pe);
    }//GEN-LAST:event_menuUsuarioActionPerformed

    private void menuAjudaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAjudaMouseEntered
        // TODO add your handling code here:
        jMenuUsuario.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuAjudaMouseEntered

    private void menuAjudaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAjudaMouseExited
        jMenuUsuario.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuAjudaMouseExited

    private void menuSobreMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSobreMouseEntered
        menuSobre.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuSobreMouseEntered

    private void menuTipoProdutoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuTipoProdutoMouseEntered
        menuTipoProduto.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuTipoProdutoMouseEntered

    private void menuTipoProdutoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuTipoProdutoMouseExited
        menuTipoProduto.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuTipoProdutoMouseExited

    private void menuAssuntoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAssuntoMouseEntered
        menuAssunto.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuAssuntoMouseEntered

    private void menuAssuntoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAssuntoMouseExited
        menuAssunto.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuAssuntoMouseExited

    private void menuSetorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSetorMouseEntered
        menuSetor.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuSetorMouseEntered

    private void menuSetorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSetorMouseExited
        menuSetor.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuSetorMouseExited

    private void MenuFuncionarioMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuFuncionarioMouseEntered
        MenuFuncionario.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_MenuFuncionarioMouseEntered

    private void MenuFuncionarioMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuFuncionarioMouseExited
        MenuFuncionario.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_MenuFuncionarioMouseExited

    private void MenuOrigemMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuOrigemMouseEntered
        MenuOrigem.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_MenuOrigemMouseEntered

    private void MenuOrigemMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuOrigemMouseExited
        MenuOrigem.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_MenuOrigemMouseExited

    private void menuUsuarioMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuUsuarioMouseEntered
        menuUsuario.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuUsuarioMouseEntered

    private void menuUsuarioMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuUsuarioMouseExited
        menuUsuario.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuUsuarioMouseExited

    private void menuSairMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSairMouseEntered
        menuSair.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_menuSairMouseEntered

    private void menuSairMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSairMouseExited
        menuSair.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuSairMouseExited

    private void jMenuUsuarioMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuUsuarioMouseEntered
        jMenuUsuario.setFont(new Font("Tahoma", Font.BOLD, 12));
    }//GEN-LAST:event_jMenuUsuarioMouseEntered

    private void jMenuUsuarioMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuUsuarioMouseExited
        jMenuUsuario.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_jMenuUsuarioMouseExited

    private void menuSobreMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuSobreMouseExited
        menuSobre.setFont(new Font("Tahoma", Font.PLAIN, 12));
    }//GEN-LAST:event_menuSobreMouseExited

    private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseClicked

        p.setVisible(false);
        LoginView l = new LoginView(LoginView.CadFiliado, true);
        l.setVisible(true);
        pagarParametros();
        p.setVisible(true);
    }//GEN-LAST:event_jLabel4MouseClicked

    private void lbReceberProcessoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbReceberProcessoMouseExited
        lbReceberProcesso.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbReceberProcessoMouseExited

    private void lbReceberProcessoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbReceberProcessoMouseEntered
        lbReceberProcesso.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbReceberProcessoMouseEntered

    private void lbReceberProcessoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbReceberProcessoMouseClicked
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameRecebeProcesso rp = new frameRecebeProcesso();
        //define o tamanho da tela, baseado no tamanho do jPanel
        rp.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(rp);
    }//GEN-LAST:event_lbReceberProcessoMouseClicked

    private void lbTramitarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbTramitarMouseExited
        lbTramitar.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbTramitarMouseExited

    private void lbTramitarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbTramitarMouseEntered
        lbTramitar.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbTramitarMouseEntered

    private void lbTramitarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbTramitarMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameTramitar dc = new frameTramitar();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbTramitarMouseClicked

    private void lbAssuntoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAssuntoMouseExited
        lbAssunto.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbAssuntoMouseExited

    private void lbAssuntoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAssuntoMouseEntered
        lbAssunto.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbAssuntoMouseEntered

    private void lbAssuntoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAssuntoMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);

        fechaInternalFrames();
        //Cria a instancia da Tela
        frameAssunto fa = new frameAssunto();
        //define o tamanho da tela, baseado no tamanho do jPanel
        fa.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(fa);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbAssuntoMouseClicked

    private void lbSetorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbSetorMouseExited
        lbSetor.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbSetorMouseExited

    private void lbSetorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbSetorMouseEntered
        lbSetor.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbSetorMouseEntered

    private void lbSetorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbSetorMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);

        fechaInternalFrames();
        //Cria a instancia da Tela
        frameSetor fs = new frameSetor();
        //define o tamanho da tela, baseado no tamanho do jPanel
        fs.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(fs);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbSetorMouseClicked

    private void lbArquivaProcessoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbArquivaProcessoMouseExited
        lbArquivaProcesso.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbArquivaProcessoMouseExited

    private void lbArquivaProcessoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbArquivaProcessoMouseEntered
        lbArquivaProcesso.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbArquivaProcessoMouseEntered

    private void lbArquivaProcessoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbArquivaProcessoMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameArquivar dc = new frameArquivar();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbArquivaProcessoMouseClicked

    private void lbPesquisaProcessoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbPesquisaProcessoMouseExited
        lbPesquisaProcesso.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbPesquisaProcessoMouseExited

    private void lbPesquisaProcessoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbPesquisaProcessoMouseEntered
        lbPesquisaProcesso.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbPesquisaProcessoMouseEntered

    private void lbPesquisaProcessoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbPesquisaProcessoMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);

        fechaInternalFrames();
        //Cria a instancia da Tela
        framePesquisarProcesso fs = new framePesquisarProcesso();
        //define o tamanho da tela, baseado no tamanho do jPanel
        fs.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(fs);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbPesquisaProcessoMouseClicked

    private void lbProcessoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbProcessoMouseExited
        lbProcesso.setFont(new Font("Tahoma", Font.PLAIN, 12));
        ajustaCursor(1);
    }//GEN-LAST:event_lbProcessoMouseExited

    private void lbProcessoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbProcessoMouseEntered
        lbProcesso.setFont(new Font("Tahoma", Font.BOLD, 12));
        ajustaCursor(2);
    }//GEN-LAST:event_lbProcessoMouseEntered

    private void lbProcessoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbProcessoMouseClicked
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameProcesso dc = new frameProcesso();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_lbProcessoMouseClicked

    private void jMProcessoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMProcessoMouseClicked
//      //Ajusta o cursor para ficar em espera
//        ajustaCursor(0);
//        //Fecha todos os internalFrames antes de abrir outro
//        fechaInternalFrames();
//        //Cria a instancia da Tela
//        frameProcesso dc = new frameProcesso();
//        //define o tamanho da tela, baseado no tamanho do jPanel
//        dc.setSize(getPanel().getSize());
//        //Chama a tela
//        this.addTelaDesk(dc);
//        //Ajusta o cursor para sua forma normal
//        ajustaCursor(1);
    }//GEN-LAST:event_jMProcessoMouseClicked

    private void jMProcessoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMProcessoActionPerformed
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameProcesso dc = new frameProcesso();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_jMProcessoActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameTramitar dc = new frameTramitar();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameRecebeProcesso rp = new frameRecebeProcesso();
        //define o tamanho da tela, baseado no tamanho do jPanel
        rp.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(rp);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        //Ajusta o cursor para ficar em espera
        ajustaCursor(0);
        //Fecha todos os internalFrames antes de abrir outro
        fechaInternalFrames();
        //Cria a instancia da Tela
        frameArquivar dc = new frameArquivar();
        //define o tamanho da tela, baseado no tamanho do jPanel
        dc.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(dc);
        //Ajusta o cursor para sua forma normal
        ajustaCursor(1);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseClicked
        p.setVisible(false);
        LoginView l = new LoginView(LoginView.CadFiliado, true);
        l.setVisible(true);
        pagarParametros();
        p.setVisible(true);
    }//GEN-LAST:event_jLabel9MouseClicked

    private void jLabel9MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseEntered
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel9MouseEntered

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(fPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(fPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(fPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(fPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                getInstancia().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem MenuFuncionario;
    private javax.swing.JMenuItem MenuOrigem;
    private javax.swing.JPanel barraInformacao;
    private javax.swing.JPanel barraLateral;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuItem jMProcesso;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuUsuario;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JPopupMenu.Separator jSeparator7;
    private javax.swing.JPopupMenu.Separator jSeparator8;
    private javax.swing.JLabel jlsetor;
    private javax.swing.JLabel lbArquivaProcesso;
    private javax.swing.JLabel lbAssunto;
    private javax.swing.JLabel lbOcara;
    private javax.swing.JLabel lbPesquisaProcesso;
    private javax.swing.JLabel lbProcesso;
    private javax.swing.JLabel lbReceberProcesso;
    private javax.swing.JLabel lbSetor;
    private javax.swing.JLabel lbTramitar;
    private javax.swing.JLabel lbUsuario;
    private javax.swing.JLabel lboSetor;
    private javax.swing.JMenu menuAjuda;
    private javax.swing.JMenuItem menuAssunto;
    private javax.swing.JMenu menuCadastro;
    private javax.swing.JMenuBar menuPrincipal;
    private javax.swing.JMenuItem menuSair;
    private javax.swing.JMenuItem menuSetor;
    private javax.swing.JMenuItem menuSobre;
    private javax.swing.JMenuItem menuTipoProduto;
    private javax.swing.JMenuItem menuUsuario;
    // End of variables declaration//GEN-END:variables

// ADICIONA TELAS (JInternalFrame) AO JDesktopPane  
// usado assim: this.addTelaDesk(new TelaFuncionarios(null));  
    public void addTelaDesk(JInternalFrame tela) {
        //for (JInternalFrame jInternalFrame : this.getTelaDesktop().getAllFrames()) {  
        for (JInternalFrame jInternalFrame : this.panelPrincipal.getAllFrames()) {
            // se uma janela semelhante estiver aberta  
            if (jInternalFrame.getClass().toString().equalsIgnoreCase(tela.getClass().toString())) {
                jInternalFrame.moveToFront(); // traz janela para frente para facilitar a escolha  
                jInternalFrame.setResizable(rootPaneCheckingEnabled);

                Object[] opções = {"Utilizar Aberta", "Abrir Nova"};
                int qst = JOptionPane.showOptionDialog(null, "Deseja trocar de usuário?",
                        "Janela duplicada",
                        JOptionPane.DEFAULT_OPTION,
                        JOptionPane.QUESTION_MESSAGE,
                        null,
                        opções,
                        opções[0]);
                // se utilizar a aberta retorna e não abre outra,  
                // caso contrário sai do for e abre outra igual  
                if (qst == 0) {
                    return;
                } else if (qst == 1) {
                    break;
                }
            }
        }

        this.panelPrincipal.add(tela); //adiciona na tela

        try {
            tela.setMaximum(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(fPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        tela.setVisible(true);         //seta visivel 
        //this.cascade();                //coloca em cascata para deixar "pratico"  
    }

//    private void cascade() {
//        JDesktopPane desk = this.panelPrincipal; // JDesktopPane  
//        Rectangle dBounds = desk.getBounds();     // Bordas do JDesktopPane  
//        int separation = 0;                      // distancia entre as janelas  
//
//        // Pega todos os frames e organiza, o ultimo fica mais em baido e mais pra cima  
//        int i = desk.getAllFrames().length; // quantidade de frames  
//        for (JInternalFrame f : desk.getAllFrames()) {
//            f.setLocation(i * separation, i * separation);
//            i--; //mutiplicador  
//        }
//    }
    //fecha todos os internalFrames
    public void fechaInternalFrames() {
        JInternalFrame[] frames = this.panelPrincipal.getAllFrames();
        for (int i = 0; i < frames.length; i++) {
            frames[i].dispose();
        }
        TesteInternal ti = new TesteInternal();
        //define o tamanho da tela, baseado no tamanho do jPanel
        ti.setSize(getPanel().getSize());
        //Chama a tela
        this.addTelaDesk(ti);

    }

    private void pagarParametros() {
        //  FachadaCadastro f = new FachadaCadastro();
        FuncionarioDAO pdao = new FuncionarioDAO();
        Funcionario p = new Funcionario();
        String s = LoginView.getUsuario();
        p = pdao.pesquisarNome(LoginView.getUsuario());

        nomeUsuario = p.getNome();
        nomeSetor = p.getSetor().getSigla();
        setorUsuario = p.getSetor();
        //mesANO = f.mesAno();
        lbOcara.setText(nomeUsuario.trim());
        lboSetor.setText(nomeSetor.trim());
        //lbQmes.setText(mesANO.substring(0, 2)+"/"+mesANO.substring(2, 6));
    }

    public void ajustaCursor(int tipo) {
        Cursor cursor;

        if (tipo == 0) {
            cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
        } else if (tipo == 1) {
            cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
        } else {
            cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
        }

        setCursor(cursor);

    }

    private void setIcone() {
//        ImageIcon icon = new ImageIcon(this.getClass().getResource("/Imagens/LogomarcaWinSAIS.png"));    
//        setIconImage(icon.getImage()); 
    }

}
